#高斯求和
import sys
sys.setrecursionlimit(10000)

def sum_number(n):
	if n <= 0:
		return 0
	return n+sum_number(n-1)

#5+sum_number(4)
#5+(4+sum_number(3))
#5+(4+(3+sum_number(2))
#......
#5+4+3+2+1 = 15

print(sum_number(5))

def tail_sum(n,result=0):
	if n == 0:
		return result
	else:
		return tail_sum(n-1,result+n)

# tail_sum(5,0)
# tail_sum(4,5)
# tail_sum(3,9)
# ....
# tail_sum（0，15）


print(tail_sum(5))